﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Web.Modal
{
    public partial class MapFunctionEditModal : System.Web.UI.UserControl
    {
        #region | InitAccess |

        public void InitAccess()
        {
            // Init Access
            AccessToolbar.Resource = "Resource";
            AccessToolbar.SaveText = "Save";
            AccessToolbar.CancelText = "Cancel";
            AccessToolbar.AddVisible = false;
            AccessToolbar.EditVisible = false;
            AccessToolbar.CopyVisible = false;
            AccessToolbar.DeleteVisible = false;
            AccessToolbar.SearchVisible = false;
            //
            AccessToolbar.SaveToolTip = "Save";
            AccessToolbar.CancelToolTip = "CancelOrUndo";
            //
            AccessToolbar.SaveClick += OnSaveClick;
            AccessToolbar.CancelClick += OnCancelClick;
            AccessToolbar.CancelAttributes.Add("OnClick", "pcModalEdit.Hide();");
        }

        private void OnCancelClick(object sender, EventArgs e)
        {

        }

        private void OnSaveClick(object sender, EventArgs e)
        {

        }

        #endregion

        protected void Page_Load(object sender, EventArgs e)
        {
            InitAccess();
        }

        public void OnLoad(Core.AccessFlag flag)
        {
            if (flag == Core.AccessFlag.Edit)
            {
                txApplication.Text = "XXX";
                txGroupNo.Text = "GXX";
                txFunction.Text = "FXX : XXXX";
                txApplication.Attributes.Add("readonly", "readonly");
                txGroupNo.Attributes.Add("readonly", "readonly");
                txFunction.Attributes.Add("readonly", "readonly");
                Page.ClientScript.RegisterStartupScript(typeof(bool), "F660DA24-27B7-45E7-961B-AEA973EFD9DD", "pcModalEdit.Show();", true);
            }
        }
    }
}